/**
 * https://leetcode-cn.com/problems/detect-capital/
 * @param {string} word
 * @return {boolean}
 */
var detectCapitalUse = function(word) {
  // 首字母大写
  if(isUppercase(word.charAt(0))){
    if(word === word.toUpperCase()){
      return true
    }
    if(word.substring(1) === word.substring(1).toLowerCase()){
      return true
    }
  }
  // 首字母小写
  else {
    if(word === word.toLowerCase()){
      return true
    }
  }
  return false
};
function isUppercase(chat){
  if(chat >= 'A' && chat <= "Z"){
    return true
  }
  else {
    return false
  }
}
function isLowercase(chat){
  if(chat >= 'a' && chat <= "z"){
    return true
  }
  else {
    return false
  }
}

console.log(detectCapitalUse('Qqw'))
